package com.pokermind.model.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 认证请求DTO
 * 
 * 使用API Key进行连接认证
 * 
 * @author PokerMind Team
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AuthRequest {
    
    /**
     * API Key
     * 格式: pk_{env}_{32位hex}
     * 示例: pk_test_a3f9c2b4d5e67890abcd1234ef567890
     */
    @JsonProperty("api_key")
    private String apiKey;
    
    /**
     * 客户端版本号
     * 示例: 1.0.0
     */
    @JsonProperty("client_version")
    private String clientVersion;
    
    /**
     * 客户端名称
     * 示例: PokerMind-CppClient
     */
    @JsonProperty("client_name")
    private String clientName;
    
    @Override
    public String toString() {
        return "AuthRequest{" +
                "apiKey='" + maskApiKey(apiKey) + '\'' +
                ", clientVersion='" + clientVersion + '\'' +
                ", clientName='" + clientName + '\'' +
                '}';
    }
    
    /**
     * 掩码API Key（只显示前8位和后4位）
     */
    private String maskApiKey(String apiKey) {
        if (apiKey == null || apiKey.length() < 12) {
            return "***";
        }
        int len = apiKey.length();
        return apiKey.substring(0, 8) + "***" + apiKey.substring(len - 4);
    }
}



